﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BLL;
using IFactory;

public partial class Week_MonthPlanResolveDetail : System.Web.UI.Page
{
    MonthDateManager dllMonthDateManager = new MonthDateManager();
    MonthPlanManager dllMonthPlanManager = new MonthPlanManager();
    UserInfoManager dllUserInfoManager = new UserInfoManager();
    QuarterPlanofManager dllQuarterPlan = new QuarterPlanofManager();
    MonthPlanDetailManager dllMonthPlanDetailManager = new MonthPlanDetailManager();
    Authentication dllAuthentication = new Authentication();
    IBussinessLogic dllUserInfo = new UserInfoManager();
    DepartmentInfoManager dllDepartment = new DepartmentInfoManager();
    Model.UserInfo objUserInfo = new Model.UserInfo();
    DataTable _powerTable = new DataTable();
    public string _MonthPlanSortId = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        dllAuthentication.isLogin();
        if (!IsPostBack)
        {
            bindGridViewMonthResolve();
        }
    }

    /// <summary>
    /// 自动分页事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gvlist_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.gdvMonthPlanResolve.PageIndex = e.NewPageIndex;
        bindGridViewMonthResolve();
    }



    /// <summary>
    /// 绑定月分解计划GridView
    /// </summary>
    void bindGridViewMonthResolve()
    {
        object[] _value = new object[1];
        _value[0] = Utility.HttpHelp.getParamsString("_MonthPlanId");
        DataTable _MonthResolve = dllMonthPlanDetailManager.get(MonthPlanDetailManager.field.MonthPlanId.ToString(), _value);
        this.gdvMonthPlanResolve.DataSource = _MonthResolve;
        this.gdvMonthPlanResolve.DataBind();
        for (int i = 0; i < this.gdvMonthPlanResolve.Rows.Count; i++)
        {
            wrapByComma(this.gdvMonthPlanResolve, i, 5);
            wrapByComma(this.gdvMonthPlanResolve, i, 6);
            if (this.gdvMonthPlanResolve.Rows[i].Cells[10].Text == "&amp;nbsp;" || this.gdvMonthPlanResolve.Rows[i].Cells[10].Text == "&nbsp;")
            {
                this.gdvMonthPlanResolve.Rows[i].Cells[10].Text = "";
            }
        }
    }


    /// <summary>
    /// 根据逗号换行事件
    /// </summary>
    void wrapByComma(GridView _gridView, int _rowIndex, int _cells)
    {
        string _content = _gridView.Rows[_rowIndex].Cells[_cells].Text;
        _gridView.Rows[_rowIndex].Cells[_cells].Text = _content.Replace("&lt;br&gt;", "<br>");
        //_gridView.Rows[_rowIndex].Cells[_cells].Text = _content.Replace("&gt;", ">");
        _gridView.Rows[_rowIndex].Cells[_cells].Text = _gridView.Rows[_rowIndex].Cells[_cells].Text.Replace(",", "<br>");


    }


   
}
